
import wepy from 'wepy'
export default class extends wepy.mixin {
    config = {};

    data = {
      swiperList: [],
      CateList: [],
      FloorList: []
    };
  
    methods = {
        goGoodsList(url){
            wepy.navigateTo({
                url
            })
        }
    };
    // 获取轮播图
    async getSwiperData() {
      const { data: res } = await wepy.get('/home/swiperdata')
      if (res.meta.status !== 200) {
        return wepy.baseToast();
      }
      console.log(res);
  
      this.swiperList = res.message;
      this.$apply();
    }
  
    // 获取分类
    async getCateData() {
      const { data: res } = await wepy.get('/home/catitems')
      if (res.meta.status !== 200) {
        return wepy.baseToast();
      }
      console.log(res);
  
      this.CateList = res.message;
      this.$apply();
    }

    // 获取楼层数据
    async getFloorData() {
        const { data: res } = await wepy.get('/home/floordata')
        if (res.meta.status !== 200) {
          return wepy.baseToast();
        }
        console.log(res);
    
        this.FloorList = res.message;
        this.$apply();
      }
  
    onLoad() {
      this.getSwiperData();
      this.getCateData();
      this.getFloorData()
    }
  

}
